package com.magicmovie.web.service;

import com.magicmovie.dto.MovieDTO;
import com.magicmovie.entity.Movie;
import com.magicmovie.utils.QueryFilters;
import com.magicmovie.utils.data.PageModel;
import com.magicmovie.web.service.impl.MovieServiceImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(name = "service", fallback = MovieServiceImpl.class)
public interface MovieService {

    @RequestMapping(value = "/movie/findByIndexCategoty", method = RequestMethod.GET)
    List<Movie> findByIndexCategoty(@RequestParam("indexCategoryId") Integer indexCategoryId);

    @RequestMapping(value = "/movie/findById", method = RequestMethod.GET)
    Map<String, Object> findById(@RequestParam("id") Integer id);
    @RequestMapping(value = "/movie/selectByPramaryKey", method = RequestMethod.GET)
    Movie selectByPramaryKey(@RequestParam("id") Integer id);

    @RequestMapping(value = "/movie/save", method = RequestMethod.POST)
    void save(@RequestBody MovieDTO movie);

    @RequestMapping(value = "/movie/findPurchasedMovie", method = RequestMethod.GET)
    Map<String, Object> findPurchasedMovie(@RequestParam("customerId") Integer customerId, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);

    @RequestMapping(value = "/movie/queryList", method = RequestMethod.POST)
    List<Map<String, Object>> queryList(@RequestBody Map<String, Object> map);

    @RequestMapping(value = "/movie/update", method = RequestMethod.POST)
    void update(@RequestBody Movie movie);

    @RequestMapping(value = "/movie/queryCount", method = RequestMethod.POST)
    Integer queryCount(@RequestBody Map<String, Object> map);


    @RequestMapping(value = "/movie/getByFilter",method = RequestMethod.POST)
    PageModel getByFilter(@RequestBody QueryFilters filters);

    @RequestMapping(value = "/movie/delete", method = RequestMethod.GET)
    void delete(@RequestParam("id") Integer id);

}
